<template>
	<view class="uni-main">
		<view class="uni-header">
			<view class="uni-group">
			</view>

			<!-- <view class="uni-group">
				<input class="uni-search" type="text" v-model="query" @confirm="search" placeholder="请输入手机号码" />
				<button class="uni-button" type="default" size="mini" @tap="search">搜索</button>
			</view> -->
		</view>

		<view class="uni-container uni-compatible">
			<uni-table>
				<uni-tr>
					<uni-th align="center">手机号码</uni-th>
					<uni-th align="center">订单号</uni-th>
					<uni-th align="center">类别</uni-th>
					<uni-th align="center">描述</uni-th>
					<uni-th align="center">创建时间</uni-th>
					<uni-th width="204" align="center">操作</uni-th>
				</uni-tr>

				<uni-tr v-for="(item, index) in data" :key="index">
					<uni-td align="center"> {{ item.phoneNo}} </uni-td>
					<uni-td align="center"> {{ item.tradeNo}} </uni-td>
					<uni-th align="center">
						{{item.leafCategoryName}}
					</uni-th>
					<uni-td align="center"> {{ item.content}} </uni-td>
					<uni-td align="center">
						{{item.gmtModified}}
					</uni-td>
					<uni-td align="center">
						<view class="uni-group">
							<button @tap="chuli(item.complainEventId)" class="uni-button" size="mini"
								type="primary">已处理</button>
						</view>
					</uni-td>
				</uni-tr>
			</uni-table>
		</view>

	</view>
</template>

<script>
	let _this;
	export default {
		data() {
			return {
				data: []
			};
		},
		onLoad() {
			_this = this;
		},
		onShow() {
			this.loadData()
		},
		methods: {
			async loadData() {
				let res = await _this.$func.wmzadmin.call('entitlement/getTradeComplainInfos', {})
				if (res.code === 200) {
					this.data = res.data
				}
			},
			async chuli(id) {
				uni.showModal({
					title: "提示",
					content: "确定已处理吗？",
					confirmColor: '#CC0000',
					async success(e) {
						if (e.confirm) {
							let res = await _this.$func.wmzadmin.call('entitlement/sumbitTradeComplainInfos', {
								id: id
							})
							if (res.code === 200) {
								_this.$message("处理成功");
								_this.loadData()
							}else{
								_this.$message("处理失败");
							}
						}
					}
				})
			}

		}
	};
</script>